package com.ray.tcc.test.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.ray.tcc.annotation.Tcc;
import com.ray.tcc.test.service.TccTestService;
import com.zjhc.flyhong.common.function.exception.BussinessException;

@Service
public class TccTestServiceImpl implements TccTestService {
	private static final Logger LOGGER = LoggerFactory.getLogger(TccTestServiceImpl.class);

	
	@Tcc(confirmMethod = "confirm", cancelMethod = "cancel")
	public boolean Test(String message) {
		LOGGER.info("============执行===============");
		throw new BussinessException(-1, "创建一个异常");
	}
	
	@Tcc(confirmMethod = "confirm", cancelMethod = "cancel")
	public boolean Ok(String message) {
		LOGGER.info("============执行===============");
		return true;
	}

	public boolean confirm(String message) {

		LOGGER.info("============执行确认付款接口===============");

		return Boolean.TRUE;
	}

	public boolean cancel(String message) {

		LOGGER.info("============执行取消付款接口===============");

		return Boolean.TRUE;
	}

}
